import Request from '@/libs/service/index';

import type {IResult,IListResult } from './type';
import { BASE_URL } from '../../request/config';
import { IAddressForm } from '@/libs/type/address';

enum LoginAPI {
    AddressList = '/address/list',
    AddressAdd = '/address/add',
    AddressUpdate = '/address/update',
    AddressRemove = '/address/remove',
}

export function addressListRequest(obj: IAddressForm) {
    return Request.post<IListResult>({
        url: BASE_URL + LoginAPI.AddressList,
        data: obj,
    });
}

export function addressAddRequest(obj: IAddressForm) {
    return Request.post<IResult>({
        url: BASE_URL + LoginAPI.AddressAdd,
        data: obj,
    });
}

export function addressUpdateRequest(obj: IAddressForm) {
    return Request.post<IResult>({
        url: BASE_URL + LoginAPI.AddressUpdate,
        data: obj,
    });
}

export function addressRemoveRequest(obj: IAddressForm) {
    return Request.post<IResult>({
        url: BASE_URL + LoginAPI.AddressRemove,
        data: obj,
    });
}